You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

21 lines
655 B

import { oauthManager } from '#server/service/oauth/oauth-manager';
import { createAuthContext } from '#server/service/auth/context';
export default defineWrappedResponseHandler(async (event) => {
const { requireUser } = createAuthContext(event);
const user = await requireUser();
const providerName = getRouterParam(event, 'provider');
const bindings = await oauthManager.getUserBindings(user.id);
const binding = bindings.find((b) => b.provider === providerName);
return R.success({
bound: !!binding,
binding: binding
? {
id: binding.id,
username: binding.username,
}
: undefined,
});
});